package only.my.railgunys.shooting;

import only.my.railgunys.artifact.ArtifactSuitEffect;
import only.my.railgunys.bean.Character;
import only.my.railgunys.bean.Enemy;
import only.my.railgunys.bean.Weapon;
import only.my.railgunys.repository.SceneRepository;
import only.my.railgunys.utils.FightUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public abstract class RoleScene {
    @Autowired
    SceneRepository sceneRepository;

    Character specialIncrease(Character character) {
        return character;
    }

    public abstract void calcWeaponData();

    protected abstract void calcArtifactSuit(Weapon weapon);

    Character initNormal90(){
        Character character = initRoleBaseInfo();
        addEnemy(character);
        addTeam(character);
        return character;
    }

    List<Character> calcSuit22(Weapon weapon, ArtifactSuitEffect suitEffect1, ArtifactSuitEffect suitEffect2) {
        Character character = initNormal90();
        return FightUtils.calcSuitIncrease(character, weapon, suitEffect1::setEffect2Piece, suitEffect2::setEffect2Piece);
    }
    List<Character> calcSuit22Sp(Weapon weapon, ArtifactSuitEffect suitEffect1, ArtifactSuitEffect suitEffect2) {
        Character character = initNormal90();
        return FightUtils.calcSuitIncrease(character, weapon, suitEffect1::setEffect2Piece, suitEffect2::setEffect2Piece, this::specialIncrease);
    }

    List<Character> calcSuit4(Weapon weapon, ArtifactSuitEffect suitEffect) {
        Character character = initNormal90();
        return FightUtils.calcSuitIncrease(character, weapon, suitEffect::setEffect2Piece, suitEffect::setEffect4Piece);
    }
    List<Character> calcSuit4Sp(Weapon weapon, ArtifactSuitEffect suitEffect) {
        Character character = initNormal90();
        return FightUtils.calcSuitIncrease(character, weapon, suitEffect::setEffect2Piece, suitEffect::setEffect4Piece, this::specialIncrease);
    }

    public abstract void addTeam(Character character);

    public void addEnemy(Character character) {

        Enemy enemy = FightUtils.initNormal90(4);
        character.setEnemy(enemy);
    }

    public abstract Character initRoleBaseInfo();
}
